/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React from 'react';
import classNames from 'classnames';
const KbChildrenWrapper = props => {
  const { children, className, ...rest } = props;
  return React.Children.map(children, child => {
    return typeof child === 'object' ? (
      React.cloneElement(child, {
        ...rest,
        className: classNames(child.props.className, className),
      })
    ) : (
      <span className={className} {...rest}>
        {child}
      </span>
    );
  });
};

export default KbChildrenWrapper;
